#include<Servo.h>
Servo ms;
char receive=0;//串口接收数据
int angle=0;//角度值
String temp="";//临时字符变量

void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);
  ms.attach(9);//pin ：9
}

void loop() {
  // put your main code here, to run repeatedly:
  while(Serial.available()>0){
    receive=Serial.read();
    temp+=receive;
  }
  if(temp!=""){
    angle=temp.toInt();
    Serial.println(angle);
  }
  temp="";
  ms.write(angle);
  delay(100);
}
